<template>
  <van-cell-group class="panel-raise-info">
    <van-field label-width="70px" label="申请时间" input-align="right" disabled :value="apply.apply_inst.apply_time"/>
    <van-field label-width="70px" label="申请部门" input-align="right" disabled :value="apply.apply_inst.apply_dept"/>
    <van-field label-width="70px" label="考核部门" input-align="right" disabled :value="apply.apply_inst.asse_dept"/>
    <van-field label-width="70px" label="考核载体" input-align="right" disabled :value="carrierText"/>
    <van-field label-width="70px" label="考核内容" input-align="right" disabled :value="contentText"/>
    <van-row class="first-row">{{carrier.content_item.item.substr(carrier.content_item.item.indexOf('。') + 1)}}</van-row>
    <van-row class="split-h last-row"/>
    <van-field label-width="70px" label="考核事项" input-align="right" disabled/>
    <van-row v-if="carrier.content_item.score_item.length > 0">
      <van-row
        v-for="(score) in carrier.content_item.score_item"
        :key="score.id"
        class="first-row">
        {{score.id + ' - ' + score.item}}
      </van-row>
      <van-row class="split-h last-row"/>
    </van-row>
    <van-field label-width="70px" type="textarea" rows="1" autosize label="加分理由" disabled/>
    <van-row class="first-row">{{apply.apply_inst.add_reson}}</van-row>
    <van-row class="split-h last-row"/>
    <van-field label-width="70px" label="加分分值" input-align="right" disabled :value="apply.apply_inst.score"/>
    <van-field label-width="70px" label="附件材料" input-align="right" disabled>
      <template v-if="apply.apply_inst.file_name !== ''" #input>
        <a :href="apply.apply_inst.file_url">{{apply.apply_inst.file_name}}</a>
      </template>
      <template v-else #input>
        <span>无附件</span>
      </template>
    </van-field>
    <van-field label-width="70px" label="申请状态" input-align="right" disabled :value="applyText"/>
  </van-cell-group>
</template>

<script>
export default {
  name: 'PanelRaiseInfo',
  props: ['apply'],
  data () {
    return {
      carrier: JSON.parse(this.apply.apply_inst.carrier_item)
    }
  },
  computed: {
    carrierText: function () {
      if (this.carrier.id !== '') {
        return this.carrier.id + ' - ' + this.carrier.item
      } else {
        return ''
      }
    },
    contentText: function () {
      if (this.carrier.content_item.id !== '') {
        return this.carrier.content_item.id + ' - ' + this.carrier.content_item.item.substr(0, this.carrier.content_item.item.indexOf('。'))
      } else {
        return ''
      }
    },
    applyText: function () {
      let str = ''
      switch (this.apply.apply_inst.apply_status) {
        case 0:
          str = '待审核'
          break
        case 1:
          str = '待最终审核'
          break
        case 2:
          str = '已复核'
          break
        case 3:
          str = '待复核'
          break
        case 4:
          str = '待修改'
          break
        case 5:
          str = '已完成'
          break
      }
      return str
    }
    // applyResult: function () {
    //   if (this.apply.op_check.approve_result === 1) {
    //     if (this.apply.apply_inst.apply_status === 2) {
    //       if (this.apply.op_review.approve_result === 1) {
    //         return '复核通过'
    //       } else {
    //         return '复核拒绝'
    //       }
    //     } else {
    //       return '审核通过'
    //     }
    //   } else {
    //     return '审核拒绝'
    //   }
    // },
    // applyReason: function () {
    //   if (this.apply.op_check.approve_result === 0) {
    //     return this.apply.op_check.refuse_reason
    //   }
    //   if (this.apply.op_review.approve_result === 0) {
    //     return this.apply.op_review.refuse_reason
    //   }
    //   return ''
    // }
  }
}
</script>

<style scoped lang="less">
  .panel-raise-info {
    .van-field{
      font-size: 12px;
    }
    .first-row {
      font-size: 12px;
      color: #969799;
      padding: 5px 16px;
    }
    .last-row {
      margin-left: 16px;
    }
    span {
      color: #969799;
    }
  }
</style>
